import  requests

from commom.get_new_auth import get_new_token
# 创建部门
# autu = get_new_token()
# resp = requests.post(url="http://ihrm2-test.itheima.net/api/company/department",
#                      headers = {"Content-Type":"application/json","Authorization":autu},
#                      json={"name":"蔡坤","code":"10088884"})
# print(resp.json())
# assert 200 == resp.status_code
# assert True == resp.json()["success"]
# assert 10000 == resp.json()["code"]
# assert "成功" in resp.json()["message"]
# 修改部门
# autu = get_new_token()
# resp = requests.put(url="http://ihrm2-test.itheima.net/api/company/department/1558049897217912832",
#                      headers = {"Content-Type":"application/json","Authorization":autu},
#                      json={"name":"蔡徐坤"})
# print(resp.json())
# assert 200 == resp.status_code
# assert True == resp.json()["success"]
# assert 10000 == resp.json()["code"]
# assert "成功" in resp.json()["message"]
# 查询部门
# autu = get_new_token()
# resp = requests.get(url="http://ihrm2-test.itheima.net/api/company/department/1558049897217912832",
#                      headers = {"Authorization":autu})
#
# print(resp.json())
# assert 200 == resp.status_code
# assert True == resp.json()["success"]
# assert 10000 == resp.json()["code"]
# assert "成功" in resp.json()["message"]
# 删除部门
# autu = get_new_token()
# resp = requests.delete(url="http://ihrm2-test.itheima.net/api/company/department/1558049897217912832",
#                      headers = {"Authorization":autu})
#
# print(resp.json())
# assert 200 == resp.status_code
# assert True == resp.json()["success"]
# assert 10000 == resp.json()["code"]
# assert "成功" in resp.json()["message"]
